<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>事件访问修饰符</title>
		
	</head>
	<body>
		<div id="app">
         数值1<input type="text" v-model="num1"/><br />
		 数值2<input type="text" v-model="num2" @keyup.enter="addNum"/><br />
		 <button @click="addNum">计算</button><br />
		 总数：<span v-text="count"></span>
		</div>
		
		<script src="https://cdn.jsdelivr.net/npm/vue@2"></script>
		<script>
			const app = new Vue({
				el:'#app',
				data: {
					num1: '',
					num2: '',
					count: ''
					 
				},
				//定义vue对象中的方法
				methods: {
				    addNum(){
						
				     this.count =parseInt (this.num1)+parseInt(this.num2)
				}
				}
			})
		</script>
		
	</body>
</html>